#define _CRT_SECURE_NO_WARNINGS 1

#include<stdio.h>
int is_num(int num)
{
    int flag = 1;
    int m = num;
    while (m>0)
    {
        int b = m % 10;
        if (m == 0 || num % b != 0)
        {
            flag = 0;
            return flag;
        }
        m /= 10;
    }
    return flag;
}
int main()
{
    int a = 0;
    int b = 0;
    scanf("%d%d", &a, &b);
    int i = 0;
    int count = 0;
    for (i = a; i <= b; i++)
    {
        if (is_num(i))
        {
            count++;
        }
    }
    printf("%d", count);
    return 0;
}